﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;

namespace QFlow.Data
{
    public static class AccountExtension
    {
        private static Account _Cashir;
        public static Account GetCashirAccount(this Table<Account> queriable)
        {
            return queriable.Single(account => account.AccountID == 1);
        }

        public static Account GetSafeAccount(this Table<Account> queriable)
        {
            return queriable.Single(account => account.AccountID == 2);
        }

        public static bool IsCashirAccount(this Table<Account> queriable, int accountId)
        {
            if (_Cashir == null)
                _Cashir = queriable.Single(account => account.AccountID == 1);
            return accountId == _Cashir.AccountID;
        }
    }
}
